package com.dzh.config;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author DZH
 * @createTime 2021/7/18 23:54
 */
@Configuration
public class ApplicationContextConfig {
    @Bean  //这种 new 的方式属于多例(非单例模式)
    @LoadBalanced //该注解赋予 RestTemplate 负载均衡机制
    public RestTemplate getRestTemplate(){
        return  new RestTemplate();
    }
}
